package com.dailyblue.java.servlet.controller;

import javax.servlet.GenericServlet;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebServlet;
import java.io.IOException;

// Servlet的第二种实现方式
// 注解实现
// 3⃣️ 注册Servlet
@WebServlet("/second")
// 1⃣️ 继承GenericServlet
public class SecondController extends GenericServlet {
    // 2⃣️ 实现service方法
    @Override
    public void service(ServletRequest req, ServletResponse resp) throws ServletException, IOException {
        System.out.println("我是SecondController`service方法！");
        req.getRequestDispatcher("index.jsp").forward(req, resp);
    }
}
